home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / ser_lib.exe / SPP.EXE / SPPMAN.TXT < prev    next >
Text File  |  1992-02-07  |  86KB  |  3,037 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                                           
  8.                                           
  9.                                           
  10.                                           
  11.                                           
  12.                                           
  13.                                           
  14.                                           
  15.                                           
  16.                                           
  17.                                           
  18.                                       Serial++
  19.                                           
  20.                         Interrupt Driven Serial Ports for C++
  21.                                           
  22.                              from Cortlandt Technologies
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                               
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.                                           
  74.  
  75.           
  76.           
  77.           
  78.           
  79.           
  80.           
  81.           
  82.           Serial++ Version 1.01
  83.           by Cortlandt Technologies
  84.           P.O. Box 195
  85.           Pleasantville NY 10570
  86.           
  87.           
  88.           
  89.           
  90.           
  91.           
  92.                                             _______
  93.                                        ____|__     |                (R)
  94.                                     --|       |    |-------------------
  95.                                       |   ____|__  |  Association of
  96.                                       |  |       |_|  Shareware
  97.                                       |__|   o   |    Professionals
  98.                                     -----|   |   |---------------------
  99.                                          |___|___|    MEMBER
  100.           
  101.           
  102.           This program is produced by a member of the Association of
  103.           Shareware Professionals (ASP).  ASP wants to make sure that the
  104.           shareware principle works for you. If you are unable to resolve a
  105.           shareware-related problem with an ASP member by contacting the
  106.           memberdirectly, ASP may be able to help. The ASP Ombudsman can
  107.           help you resolve a dispute or problem with an ASP member, but
  108.           does not provide technical support for members' products.  Please
  109.           write to the ASP Ombudsman at 545 Grover Road, Muskegon, MI 49442
  110.           or send a CompuServe message via CompuServe Mail to ASP Ombudsman
  111.           70007,3536.
  112.  
  113.           
  114.           
  115.           Copyright Notice:
  116.  
  117.           Serial++ is Copyright (c) 1991 by Cortlandt Technologies.  All
  118.           rights reserved.
  119.  
  120.           This manual is Copyright (c) 1991 by Cortlandt Technologies.  All
  121.           rights reserved.
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                               
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.           
  140.  
  141.           
  142.           
  143.           
  144.           
  145.           
  146.           
  147.           
  148.           
  149.           
  150.           
  151.           
  152.           
  153.           
  154.           
  155.           
  156.           
  157.           
  158.           
  159.           
  160.           
  161.           
  162.           
  163.           
  164.           
  165.           
  166.           
  167.           
  168.           
  169.           
  170.           
  171.           Warranty Disclaimer
  172.  
  173.           CORTLANDT TECHNOLOGIES MAKES NO WARRANTY OF ANY KIND, EXPRESSED
  174.           OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY WARRANTIES OF
  175.           MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
  176.  
  177.           CORTLANDT TECHNOLOGIES DOES NOT ASSUME ANY LIABILITY FOR THE USE
  178.           OF THIS SOFTWARE BEYOND THE ORIGINAL PURCHASE PRICE OF THIS
  179.           SOFTWARE.
  180.  
  181.           IN NO EVENT WILL CORTLANDT TECHNOLOGIES BE LIABLE TO YOU FOR ANY
  182.           ADDITIONAL DAMAGES, INCLUDING ANY LOST PROFITS, LOST SAVINGS, OR
  183.           OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM THE USE
  184.           OF, OR INABILITY TO USE, THIS SOFTWARE AND ITS ACCOMPANYING
  185.           DOCUMENTATION, EVEN IF CORTLANDT TECHNOLOGIES, HAS BEEN ADVISED
  186.           OF THE POSSIBILITY OF SUCH DAMAGES.
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                               
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.                                   Table of Contents
  206.  
  207.                Introduction........................................4
  208.  
  209.                Hardware/Software Requirements......................5
  210.  
  211.                Installing Serial++.................................6
  212.  
  213.                Installing .LIB Library Files.......................7
  214.  
  215.                Installing .H Include Files.........................8
  216.  
  217.                Using This Manual and Serial++......................10
  218.  
  219.                     Serial Ports...................................10
  220.  
  221.                     Break Trapping.................................13
  222.  
  223.                     Memory Models..................................13
  224.  
  225.                     Serial++ with Overlays.........................14
  226.  
  227.                SerialPort Function Reference.......................14
  228.  
  229.                     constructor....................................14
  230.  
  231.                     destructor.....................................15
  232.  
  233.                     getBreakOff....................................16
  234.  
  235.                     getCommPort....................................17
  236.  
  237.                     getDataBits....................................17
  238.  
  239.                     getLSR.........................................18
  240.  
  241.                     getMSR.........................................19
  242.  
  243.                     getParity......................................20
  244.  
  245.                     getSpeed.......................................21
  246.  
  247.                     getStopBits....................................21
  248.  
  249.                     inbyte.........................................22
  250.  
  251.                     inmem..........................................23
  252.  
  253.                     instr..........................................24
  254.  
  255.                     isOwner........................................25
  256.  
  257.                     lineOK.........................................26
  258.  
  259.  
  260.  
  261.                               
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.                     outbyte........................................27
  272.  
  273.                     outmem.........................................27
  274.  
  275.                     outstr.........................................28
  276.  
  277.                     sendBreak......................................28
  278.  
  279.                     setMCR.........................................29
  280.  
  281.                     unbyte.........................................30
  282.  
  283.                     constructor....................................31
  284.  
  285.                     destructor.....................................31
  286.  
  287.                     breakCt........................................32
  288.  
  289.                     isBreak........................................33
  290.  
  291.                     isCaptured.....................................34
  292.  
  293.                     isOwner........................................35
  294.  
  295.                     operator().....................................35
  296.  
  297.                     reset..........................................36
  298.  
  299.                     Serial++ is Shareware..........................38
  300.  
  301.                     Registration Information.......................38
  302.  
  303.                     Limited Distribution License...................39
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                               
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.           Introduction
  339.  
  340.           Serial++ is a library of small, safe, and efficient routines that
  341.           bring interrupt driven serial port support to your C++ programs.
  342.           It is compiled and linked with the Borland C++ compiler, and
  343.           supplied in the form of a set of ready to link object libraries.
  344.  
  345.           The routines in Serial++ are as easy to use as file i/o in C, yet
  346.           give you complete access to the registers of the 8250 UART,
  347.           should you require it.  They allow you to read characters from
  348.           and write characters to two serial ports simultaneously, in a
  349.           fashion very similar to stream i/o in C.  Support for iostreams
  350.           as defined in C++ version 2.0 is not available as of this
  351.           release.
  352.  
  353.           Implemented as C++ classes, the Serial++ library handles multiple
  354.           ports and multiple instantiations with ease.  The SerialPort and
  355.           BreakTrap classes contain all the internal housekeeping necessary
  356.           to deal with  multiple instances of the each class using a single
  357.           port.  It is because of this feature that Serial++ lends itself
  358.           nicely to event driven applications.
  359.  
  360.           Serial++ protects your applications from keyboard breaks,
  361.           (pressing the Control-Break or Control-C keys), to insure that
  362.           the necessary interrupt housekeeping is completed before
  363.           terminating,.  This guarantees that premature closing of a
  364.           Serial++ application will not leave your system with invalid
  365.           service routine addresses hooked to the serial interrupts..
  366.  
  367.           By default SerialPort will perform an orderly shutdown when a
  368.           break key is pressed, and exit to DOS. You can, however, specify
  369.           that keyboard breaks be handled in your own application code, in
  370.           which case SerialPort will continue to operate and ignore the
  371.           break. See the section on break trapping for details on how this
  372.           works.
  373.  
  374.           You can also use the keyboard break handling in Serial++ by
  375.           itself.  The BreakTrap class is entirely independent of the
  376.           SerialPort class.
  377.  
  378.           Serial++ is linked into your C++ programs just like any other
  379.           library.  There is absolutely no requirement for external TSR's -
  380.           - applications using Serial++ are completely self contained.
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                              4
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.           
  404.  
  405.  
  406.           Hardware/Software Requirements
  407.  
  408.           Serial++ may be used on any PC or PC-AT compatible computer,
  409.           running on an Intel(Tm) 8088, 8086, or 80x86 family processor or
  410.           compatible, that uses standard port addresses for COM1 and COM2.
  411.  
  412.           It is worth mentioning that Serial++ assumes that your serial
  413.           port hardware makes use of the National Semiconductor 8250 UART
  414.           chip, or a clone of it.  It is almost unheard of to find hardware
  415.           that uses anything else, so if you don't know what your serial
  416.           board uses, you're alright.  Be aware of this issue though, if
  417.           you use some sort of exotic or proprietary serial boards in your
  418.           machine.  When in doubt, try executing the demo program on your
  419.           target machine.
  420.  
  421.           While Serial++ is unaffected by machine speed, and has been run
  422.           on machines operating at 4.77 to 33 MHz, it does expect to find
  423.           the serial ports and interrupt vector addresses at very specific
  424.           locations:
  425.  
  426.           Device    Base i/o Address    Int. Vector Address
  427.           COM1:     0x03F8              0x000C
  428.           COM2      0x02F8              0x000B
  429.           
  430.           Keyboard:
  431.           Ctrl-Brk  n/a                 0x0023
  432.           Ctrl-C    n/a                 0x001B
  433.  
  434.           If you have difficulty getting the demo program to work, you
  435.           might want to consult the technical documentation that comes with
  436.           your computer to verify the addresses shown above.
  437.  
  438.           Serial++ requires MS-DOS, version 2.11 or higher. [The library
  439.           has been tested and works with version 5.00].  Serial++ uses DOS
  440.           functions for saving, setting, and restoring interrupt service
  441.           routine addresses.
  442.  
  443.           While it is running, Serial++ traps the interrupts mentioned in
  444.           the table above.  Although it restores the addresses of the prior
  445.           service routines upon exit, while it is running Serial++ could
  446.           interfere with any TSR's that utilizes any of the listed
  447.           interrupts.  Consult the documentation of any TSR's you use that
  448.           provide serial communications or respond to the Control-Break or
  449.           Control-C keys.
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.                              5
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.           
  470.  
  471.  
  472.           Installing Serial++
  473.  
  474.           Serial++ is distributed as a self-extracting archive file,
  475.           SPP.EXE.  The first step in installation is to copy this file
  476.           into a work directory and execute it by typing:
  477.           
  478.                C:>spp
  479.           
  480.           at the DOS command prompt.  SPP will announce each file as it is
  481.           unpacked looking something like this:
  482.           
  483.  
  484.             . . .
  485.             
  486.             READ.ME .
  487.             PACKING.LST .
  488.             SPPL.LIB .
  489.             BREAK.H .
  490.             SERIAL.H
  491.             SPPS.LIB .
  492.             . . .
  493.             
  494.  
  495.           After you have expanded SPP.EXE into its component files, you may
  496.           delete it from your install work directory, to save space.
  497.  
  498.           The first file to check is READ.ME, which may contain updated
  499.           information about Serial++.  You may also wish to examine the
  500.           contents of PACKING.LST, which lists every file in the package,
  501.           along with a brief description.
  502.  
  503.           The files included in the Serial++ package fall into the
  504.           following groups:
  505.  
  506.             >  Library files, SPPx.LIB.  There is one library file for each
  507.                  memory model supported by Serial++.
  508.  
  509.             >  Include files, *.H. These are C++ source includes that
  510.                  define the public interface of the classes that make up
  511.                  Serial++.
  512.  
  513.             >  Demo related files, *.CPP, *.BAT, *.MAK, etc. These files
  514.                  are included to provide you with some examples of how to
  515.                  use Serial++.  They include an executable demo program,
  516.                  SPPDEMO.EXE, which is ready to run.
  517.  
  518.             >  Documentation, READ.ME, PACKING.LST, and the file that
  519.                  contains this document, SPPMAN.TXT.
  520.  
  521.           In order to begin using Serial++, you must place the library and
  522.           include files in a directory where the C++ compiler and linker
  523.  
  524.  
  525.                              6
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.           can locate them.  You have several options as to where to keep
  536.           these files, as explained below.  The placement of the
  537.           documentation and demo files is of course not critical, they may
  538.           be placed in any convenient directory, or removed after
  539.           installation.
  540.  
  541.  
  542.           Installing .LIB Library Files
  543.  
  544.           The goal with the .LIB files is to get them into the library
  545.           search path used by the Borland C++ linker, TLINK. There are
  546.           three  ways to accomplish this:
  547.  
  548.             1  Keep the libraries in the directory where you normally
  549.                  compile and link programs.  The Borland C++ compiler will
  550.                  automatically search the current directory for any .LIB
  551.                  file explicitly listed in a project or on the command line
  552.                  of the command line compiler.  This is the simplest of the
  553.                  three options.  If the directory you expanded SPP.EXE in
  554.                  happens to be the directory where you compile and link,
  555.                  your libraries are installed!
  556.  
  557.             - OR -
  558.  
  559.             2  Copy the Serial++ libraries into the directory where the
  560.                  standard libraries provided by Borland reside.  This
  561.                  directory is also automatically searched by the compiler.
  562.                  In most installations, this would be directory:
  563.                  
  564.                     \BORLANDC\LIB
  565.                  
  566.                  unless you have changed the default Borland directory
  567.                  names.  From the directory where you expanded SPP.EXE,
  568.                  issue these DOS commands:
  569.                  
  570.                     C:> COPY SPP?.LIB  \BORLANDC\LIB
  571.                               (or whatever it is on your system)
  572.                  
  573.                     C:> DEL SPP?.LIB
  574.                          (to get rid of the temporary copies.)
  575.                  
  576.                  
  577.  
  578.             - OR -
  579.  
  580.             3  Keep the libraries in their own directory, and change the
  581.                  compiler's library search path.  This can be accomplished
  582.                  in several ways:
  583.                  
  584.                  If you use the Borland IDE compiler, from within the
  585.                  environment select Options Directories, and add to the
  586.                  beginning of the search path the directory that will
  587.                  contain the Serial++ libraries.  If you wished to place
  588.                  them in directory \SPP for example, the new library search
  589.  
  590.  
  591.                              7
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.                  path might look like:
  602.                  
  603.                     \SPP;\BORLAND\LIB;...
  604.                  
  605.                  Be sure to save the environment after making the change by
  606.                  selecting Options Save from the menu.
  607.                  
  608.                  Alternatively, you could use the BCINST program provided
  609.                  with Borland C++ to make the change above in the IDE
  610.                  program itself, BC.EXE. Again, add the path to the
  611.                  Serial++ library directory and a semicolon to the
  612.                  beginning of the library search path.
  613.                  
  614.                  If you prefer the command line compiler BCC.EXE, with or
  615.                  without configuration files, you can achieve the same
  616.                  result as described above by using the compiler's -L
  617.                  switch.  As above, changing the switch to read:
  618.                  
  619.                     -L\SPP;\BORLANDC\LIB;...
  620.                  
  621.                  would insert the path to our hypothetical Serial++
  622.                  libraries directory into the search path.
  623.  
  624.  
  625.           Installing .H Include Files
  626.  
  627.           Although the Borland C++ compiler handles searching for include
  628.           files a little differently than libraries, a basically similar
  629.           strategy will work for installing the SERIAL.H and BREAK.H
  630.           include files.
  631.  
  632.             1  Keep the include files in the directory where you normally
  633.                  compile and link programs.  This is the default situation
  634.                  that the C++ compiler expects --as mentioned before, if
  635.                  the directory you expanded SPP.EXE in happens to be the
  636.                  directory where you compile and link, you're done!
  637.  
  638.             - OR -
  639.  
  640.             2  Copy the Serial++ include files into the directory where the
  641.                  standard include files reside.  This directory is also
  642.                  automatically searched by the compiler.  In most
  643.                  installations, this would be directory:
  644.                  
  645.                     \BORLANDC\INCLUDE
  646.                  
  647.                  unless you have changed the default Borland directory
  648.                  names.  From the directory where you expanded SPP.EXE,
  649.                  issue these DOS commands:
  650.                  
  651.                     C:> COPY SERIAL.H  \BORLANDC\INCLUDE
  652.                     C:> COPY BREAK.H   \BORLANDC\INCLUDE
  653.                               (or whatever it is on your system)
  654.                  
  655.  
  656.  
  657.                              8
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.                     C:> DEL BREAK.H
  668.                     C:> DEL SERIAL.H
  669.                          (to get rid of the temporary copies.)
  670.                  
  671.                  
  672.  
  673.             - OR -
  674.  
  675.             3  Keep the include files in their own directory, and change
  676.                  the compiler's include search path.  This can be
  677.                  accomplished in several ways:
  678.                  
  679.                  If you use the Borland IDE compiler, from within the
  680.                  environment select Options Directories, and add to the
  681.                  beginning of the include search path the directory that
  682.                  will contain the Serial++ include files.  If you wished to
  683.                  place them in directory \SPP for example, the new include
  684.                  search path might look like:
  685.                  
  686.                     \SPP;\BORLAND\INCLUDE;...
  687.                  
  688.                  Be sure to save the environment after making the change by
  689.                  selecting Options Save from the menu.
  690.                  
  691.                  Alternatively, you could use the BCINST program provided
  692.                  with Borland C++ to make the change above in the IDE
  693.                  program itself, BC.EXE. Again, add the path to the
  694.                  Serial++ include files directory and a semicolon to the
  695.                  beginning of the include search path.
  696.                  
  697.                  If you prefer the command line compiler BCC.EXE, with or
  698.                  without configuration files, you can achieve the same
  699.                  result as described above by using the compiler's -I
  700.                  switch.  As above, changing the switch to read:
  701.                  
  702.                     -I\SPP;\BORLANDC\INCLUDE;...
  703.                  
  704.                  would insert the path to our hypothetical Serial++ include
  705.                  files directory into the search path.
  706.  
  707.  
  708.           Getting Started
  709.  
  710.           The first thing you will want to try is to execute the demo
  711.           program supplied with Serial++: SPPDEMO.EXE.
  712.  
  713.           This is a very simple program that demonstrates some of the basic
  714.           capabilities of the Serial++ classes. It allows you to open a
  715.           conversation on either serial port, and accepts strings from the
  716.           keyboard to send to the port, and waits up to two seconds for a
  717.           reply from the port which it echoes to the screen.
  718.  
  719.           This program is useful because it provides a quick check that
  720.           Serial++ will work with your hardware.  It also gives you a
  721.  
  722.  
  723.                              9
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.           simple working example of source code that you can compile and
  734.           link to check out your installation of Serial++.
  735.  
  736.           If your computer is equipped with a smart modem, you will find it
  737.           a handy partner for trying out SPPDEMO.EXE. Try using SPPDEMO to
  738.           send commands to the modem -- you should see SPPDEMO echo the
  739.           modem's acknowledgements on the screen.
  740.  
  741.           If you have difficulty compiling and linking SPPDEMO using the
  742.           supplied make file, check the configuration section at the bottom
  743.           of the make file, and the TLINK command, for the library and
  744.           include search paths.  Make sure that the paths listed in the -I
  745.           and -L compiler switches match the installation of the compiler
  746.           on your machine.
  747.  
  748.           SPPDEMO.CPP shows a simple example of how to use the SerialPort
  749.           class for reading and writing; for many of your applications this
  750.           level of complexity will most likely be all you need.  Be sure to
  751.           browse through the function reference to get a complete picture
  752.           of the flexibility of the Serial++ library.
  753.  
  754.  
  755.           Using This Manual and Serial++
  756.  
  757.           Perhaps the best way to become acquainted with Serial++ is to
  758.           take the sample program, SPPDEMO.CPP, and modify it to suit you
  759.           needs.  However,by reviewing some background on the internal
  760.           workings of the SerialPort and BreakTrap classes, along with
  761.           function reference that follows, you will be able to write some
  762.           very sophisticated serial port handling right from C++.
  763.  
  764.           The following sections contain a brief description of how
  765.           SerialPort and BreakTrap are structured, and provide some
  766.           practical information you will need to know to get the most out
  767.           of the package.
  768.  
  769.             Serial Ports
  770.  
  771.             The first two serial ports in your system, COM1: and COM2:, are
  772.             supported for input and output by the class SerialPort.  You
  773.             will need at least one instance of SerialPort for each port you
  774.             wish to use in your program.  You may have more than one
  775.             instance of SerialPort associated with each physical port, but
  776.             only one, the first instance to be created, will control the
  777.             port parameters.  Also, the port will remain under the control
  778.             of your program until that first SerialPort instance, the one
  779.             which opened the port, passes out of scope and has its
  780.             destructor executed.  We will come back to this point again
  781.             later, as it has a major effect on how you will want to
  782.             instantiate SerialPort objects in your programs.
  783.  
  784.             The SerialPort class consists of two portions: one portion is
  785.             static, hidden from your application code and always resident.
  786.             This portion, which is referred to as the port anchor (you will
  787.  
  788.  
  789.                              10
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.             notice a reference to a structure named PortAnchor in the
  800.             definition of class SerialPort), contains the interrupt service
  801.             routine code, along with a block of data required to service
  802.             the port. This data includes such things as the pointer to the
  803.             buffer used for port input, and it's current position.  There
  804.             is one port anchor for each of the two physical ports
  805.             supported, and each is either busy or available for use by an
  806.             instantiation of SerialPort for the duration of your program.
  807.  
  808.             The dynamic part of class SerialPort is the portion that gets
  809.             created with each instantiation: it records the port parameters
  810.             you set when you created it, and points to the port anchor
  811.             corresponding to the port you specified in the constructor
  812.             call. Each instance of SerialPort also knows if it is the owner
  813.             of the port anchor: if it is the first instance to refer to
  814.             that port, the parameters you specified (or defaulted to) at
  815.             creation time are applied to the port and that instance owns
  816.             the port until it is destroyed.
  817.  
  818.             Only the owner instance can set the speed, parity data and stop
  819.             bit setting for a port, and the port is closed only when its
  820.             owner is destroyed.  You may create and destroy as many other
  821.             instances of SerialPort for a given physical port as you need,
  822.             only the owner will set the port up, or close it down.
  823.             Although the set up parameters of the second and subsequent
  824.             instances of SerialPort for a given physical port are ignored,
  825.             all of the instances can read and write to the port.  They will
  826.             all do so at using the parameters established when the port
  827.             owner instance was created.
  828.  
  829.             For example, in this code fragment:
  830.  
  831.                SerialPort com1(COM_1,B_2400,D_8,P_N,S_1);
  832.                . . .
  833.                SerialPort *newcom = new SerialPort(COM_1,B_1200);
  834.                . . .
  835.                com1.outstr("Hello,world");
  836.                newcom->outstr("\n...via modem!\n");
  837.  
  838.             both instances pointing to COM1:, com1 and newcom, will output
  839.             strings to the port at 2400 baud, the value set at the creation
  840.             of the owner instance, com1.
  841.  
  842.             Note also in this example that when com1 goes out of scope and
  843.             is destroyed, the port is closed.  If instance newcom still
  844.             exists after that happens, all attempts to communicate to the
  845.             port with newcom will return error status, and interrogating
  846.             the status of the port through newcom will show the line
  847.             unavailable.
  848.  
  849.             This internal architecture of SerialPort allows you to
  850.             initialize your ports early in your program, perhaps by
  851.             declaring a SerialPort instance of file scope in your main
  852.             module, and then to create a temporary instance anywhere you
  853.  
  854.  
  855.                              11
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.             need throughout your program to access the port, without the
  866.             need to pass around or declare a global pointer to the port.
  867.             All SerialPort instances, owners or not, can find and use the
  868.             open port to which they refer.
  869.  
  870.             Another characteristic of SerialPort that is worth noting: the
  871.             input and output member functions of SerialPort are all
  872.             declared virtual.  This facilitates creating derived classes
  873.             from SerialPort, if you wish to perform some preprocessing of
  874.             input streams, or post-processing of output streams.  If you do
  875.             override an inherited i/o member function, be sure to call the
  876.             corresponding SerialPort routine from your new routine to
  877.             perform the actual port i/o.
  878.  
  879.             Line and port status functions are not virtual in SerialPort.
  880.  
  881.             One final note: if you look at the definition of SerialPort in
  882.             SERIAL.H, you will notice that the parameters passed to the
  883.             constructor and returned by the get...() member functions are
  884.             all defined as enum values, instead of simple integers.  This
  885.             was done for two reasons:  first, since most of these
  886.             parameters accept discrete rather than continuous values, using
  887.             enums is an easy way to get the compiler to insure that no out
  888.             of range values will be passed as parameters.
  889.  
  890.             The second reason is that by defining enums with user-
  891.             meaningful names, the actual values passed can be whatever is
  892.             convenient from a coding point of view.  If you look at the
  893.             enums at the beginning of SERIAL.H, you will notice that
  894.             although the value names make sense, the values themselves
  895.             really don't, outside of the context of the code that uses
  896.             them.
  897.  
  898.             Break Trapping
  899.  
  900.             SerialPort uses keyboard break trapping to insure a safe and
  901.             complete shutdown in the event of a user generated keyboard
  902.             break.  By default, SerialPort will restore all interrupt
  903.             vectors to their original addresses and immediately exit to DOS
  904.             when it detects a keyboard break.  It will not return control
  905.             to your program before exiting after a break.  Checking for a
  906.             trapped keyboard break is the first action performed in all of
  907.             the i/o member functions, and most of the status functions of
  908.             Serial++; but be aware that your program could run for quite
  909.             some time until the next serial port operation discovers that a
  910.             keyboard break has occurred.
  911.  
  912.             This behavior can be overridden by setting the SerialPort
  913.             constructor parameter brk_off non-zero (true).  This flag
  914.             causes SerialPort to ignore trapped breaks, and continue to
  915.             execute without interruption.
  916.  
  917.             If you use SerialPort with breaks ignored, you may wish to trap
  918.             and handle keyboard breaks in your own application.  This is
  919.  
  920.  
  921.                              12
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.             easily done by including an instance of the BreakTrap class in
  932.             your program.
  933.  
  934.             BreakTrap is a very simple class that performs two services for
  935.             your program.  First, it traps keyboard breaks (Control-Break
  936.             and Control-C), preventing them from interrupting your program,
  937.             and second it provides a mechanism for your program to
  938.             determine if a keyboard break has occurred.  You may freely
  939.             include and use BreakTrap in your programs that use SerialPort,
  940.             because BreakTrap, like SerialPort, makes use of a static
  941.             anchor structure that all instances share.  Therefore no
  942.             contention occurs regardless of the number of concurrent
  943.             instances of BreakTrap or SerialPort.
  944.  
  945.             BreakTrap provides you application with a number of member
  946.             functions with which it can determine if one or many keyboard
  947.             breaks have occurred, reset the break flag, an even check to
  948.             make sure that some other instance of BreakTrap hasn't released
  949.             the trap.  Please see the individual member function
  950.             descriptions listed in the function reference for more
  951.             information.
  952.  
  953.             Memory Models
  954.  
  955.             The Serial++ library is provided as four separate library
  956.             files, that may be used with five different memory models
  957.             supported by Borland C++.  The files and models are:
  958.  
  959.                     Memory Model   Library File
  960.                
  961.                     Tiny,Small     SPPS.LIB
  962.                     Medium         SPPM.LIB
  963.                     Compact        SPPC.LIB
  964.                     Large          SPPL.LIB
  965.  
  966.             Select the library file that matches the memory model you are
  967.             using, and name that file as part of your project, or in the
  968.             TLINK command in your make file.  Consult your compiler
  969.             documentation for further information on memory model support.
  970.  
  971.             Serial++ with Overlays
  972.  
  973.             The routines contained in SerialPort and BreakTrap contain
  974.             static portions that once enabled must remain at their absolute
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.                              13
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.             memory addresses.  This fact is common to all interrupt service
  998.             routines.
  999.  
  1000.             Serial++ may be used in overlaid programs, as long as the
  1001.             Serial++ routines are loaded as part of the "root" or non-
  1002.             swapped portion of the program.
  1003.  
  1004.             As long as you can control the use of overlays and guarantee
  1005.             that the Serial++ routines will never get swapped out or
  1006.             written over, everything should work just fine.
  1007.  
  1008.  
  1009.           SerialPort Function Reference
  1010.  
  1011.             ++++++++++++++++++++++++++++++++++++++++
  1012.  
  1013.             constructor
  1014.  
  1015.             Usage:
  1016.  
  1017.                SerialPort(CommPorts    cp ,
  1018.                           Baud     sp   = B_1200,
  1019.                           DataBits db   = D_8,
  1020.                           Parity   ps   = P_N,
  1021.                           StopBits sb   = S_1,
  1022.                           size_t b_size = SERIALPORT_STD_BUF_SIZE,
  1023.                           int  brk_off  = 0)
  1024.  
  1025.             Returns:
  1026.  
  1027.                n/a
  1028.  
  1029.             Description:
  1030.  
  1031.                The SerialPort constructor allocates an instance of
  1032.                SerialPort, and links it to the port anchor that services
  1033.                the requested port.  If the port is not currently open,
  1034.                SerialPort opens it and makes this instance the port owner.
  1035.                The values passed into (or defaulted to) the constructor are
  1036.                used to set up the port.  For the complete range of port
  1037.                parameters supported, please see the enums located in file
  1038.                SERIAL.H.
  1039.  
  1040.                If the requested port is already open, this instance is
  1041.                linked to it, and the port parameters passed in are ignored.
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.                              14
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.             Parameters:
  1064.  
  1065.                CommPorts cp:       Selects the desired port, COM1: or
  1066.                                    COM2:. No default.
  1067.  
  1068.                Baud sp:            Selects the port speed. Defaults to 1200
  1069.                                    baud.
  1070.  
  1071.                DataBits db:        Selects number of data bits per
  1072.                                    character. Default is 8.
  1073.  
  1074.                Parity ps:          Selects desired character parity
  1075.                                    checking. Default is no parity checking.
  1076.  
  1077.                StopBits sb:        Selects number of stop bits per
  1078.                                    character. Default is 1.
  1079.  
  1080.                size_t b_size:      Sets size of buffer to use for input
  1081.                                    characters from the selected port.
  1082.                                    Default is 2048 bytes, defined in
  1083.                                    SERIAL.H.
  1084.  
  1085.                int brk_off:        Flag to turn off automatic keyboard
  1086.                                    break handling in SerialPort.  If flag
  1087.                                    is true (non-zero), SerialPort ignores
  1088.                                    keyboard breaks and continues to operate
  1089.                                    if they occur.  If flag is false (zero,
  1090.                                    this is the default), SerialPort does an
  1091.                                    orderly shutdown of all ports and exits
  1092.                                    to DOS immediately.
  1093.  
  1094.                                    Although this flag is set in the
  1095.                                    SerialPort constructor, the flag is sets
  1096.                                    is global to all ports, therefore if you
  1097.                                    wish to disable break handling in
  1098.                                    SerialPort, every SerialPort constructor
  1099.                                    must be called with brk_off non-zero.
  1100.  
  1101.             Examples:
  1102.  
  1103.                SerialPort com1(COM_1,2400,D_7,P_E,S_1);
  1104.  
  1105.                SerialPort *cport = new SerialPort(COM_2); // using defaults
  1106.  
  1107.  
  1108.             ++++++++++++++++++++++++++++++++++++++++
  1109.  
  1110.             destructor
  1111.  
  1112.             Usage:
  1113.  
  1114.                n/a
  1115.  
  1116.  
  1117.  
  1118.  
  1119.                              15
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.             Returns:
  1130.  
  1131.                n/a
  1132.  
  1133.             Description:
  1134.  
  1135.                The SerialPort destructor deallocates the storage associated
  1136.                with this instance.  If this instance is the owner of the
  1137.                port, the port is closed and all trapped interrupts are
  1138.                returned to their prior state.  If the current instance is
  1139.                not the port owner, the port is not closed.
  1140.  
  1141.                If you wish to change the parameters in use for a particular
  1142.                port, or close the port permanently, you must destroy the
  1143.                SerialPort instance that owns the port.  After destroying
  1144.                the port owner, you may reopen the port with different
  1145.                parameters if you wish by instantiating a new SerialPort
  1146.                object linked to the port.
  1147.  
  1148.                A port may be closed or closed and re-opened even if other
  1149.                non-owner instances are linked to the port.  Attempts to use
  1150.                the port while it is closed results in error returns from
  1151.                the SerialPort member functions, and causes no harm.
  1152.                Changed port parameters are not a problem either, because
  1153.                all instances linked to a particular port use the parameters
  1154.                set by the owner instance.
  1155.  
  1156.             Parameters:
  1157.  
  1158.                n/a
  1159.  
  1160.             Examples:
  1161.  
  1162.                SerialPort cport= new SerialPort(COM_1);  // owns COM_1
  1163.                ...
  1164.                if (...
  1165.                     {
  1166.                     SerialPort com1(COM_1,2400); // uses cport's parameters
  1167.                     ...
  1168.                     }                   // com1 destroyed, port still open
  1169.                     ...
  1170.                delete cport;             // now the port is closed
  1171.  
  1172.  
  1173.             ++++++++++++++++++++++++++++++++++++++++
  1174.  
  1175.             getBreakOff
  1176.  
  1177.             Usage:
  1178.  
  1179.                int getBreakOff(void);
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.                              16
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.             Returns:
  1196.  
  1197.                An integer value, true (non-zero) if SerialPort is ignoring
  1198.                keyboard breaks, false (zero) if keyboard breaks will
  1199.                interrupt SerialPort.
  1200.  
  1201.             Description:
  1202.  
  1203.                n/a
  1204.  
  1205.             Parameters:
  1206.  
  1207.             n/a
  1208.  
  1209.             Examples:
  1210.  
  1211.                SerialPort com1(COM_1);
  1212.                ...
  1213.                int breaks_off = com1.getBreakOff();
  1214.  
  1215.  
  1216.             ++++++++++++++++++++++++++++++++++++++++
  1217.  
  1218.             getCommPort
  1219.  
  1220.             Usage:
  1221.  
  1222.                CommPorts getCommPort(void);
  1223.  
  1224.             Returns:
  1225.  
  1226.                The enum CommPorts value corresponding to the port to which
  1227.                this instance is linked.
  1228.  
  1229.             Description:
  1230.  
  1231.                n/a
  1232.  
  1233.             Parameters:
  1234.  
  1235.                n/a
  1236.  
  1237.             Examples:
  1238.  
  1239.                SerialPort com1(COM_1);
  1240.                ...
  1241.                CommPorts cp = com1.getBreakOff();
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.                              17
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.             ++++++++++++++++++++++++++++++++++++++++
  1262.  
  1263.             getDataBits
  1264.  
  1265.             Usage:
  1266.  
  1267.                DataBits getDataBits(void);
  1268.  
  1269.             Returns:
  1270.  
  1271.                The enum DataBits value in use by the port to which this
  1272.                instance is linked.
  1273.  
  1274.             Description:
  1275.  
  1276.                n/a
  1277.  
  1278.             Parameters:
  1279.  
  1280.                n/a
  1281.  
  1282.             Examples:
  1283.  
  1284.                SerialPort com1(COM_1);
  1285.                ...
  1286.                DataBits db = com1.getDataBits();
  1287.  
  1288.  
  1289.             ++++++++++++++++++++++++++++++++++++++++
  1290.  
  1291.             getLSR
  1292.  
  1293.             Usage:
  1294.  
  1295.                int getLSR(LSR_Masks mm);
  1296.  
  1297.             Returns:
  1298.  
  1299.                An int value that is true (non-zero) if the 8250's Line
  1300.                Status Register bit corresponding to the mask passed in is
  1301.                1, otherwise false (zero).
  1302.  
  1303.             Description:
  1304.  
  1305.                The 8250's Line Status Register reflects the current state
  1306.                of port data line.  By selecting the mask corresponding to
  1307.                the line condition you wish to test from the enum LSR_Masks
  1308.                in SERIAL.H, you can use this routine to return the truth
  1309.                value of that line condition.  You may OR together several
  1310.                masks if you wish to test for multiple conditions in a
  1311.                single call.
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.                              18
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.             Parameters:
  1328.  
  1329.                LSR_Masks mm:       One or more mask values selected from
  1330.                                    the enum defined in SERIAL.H:
  1331.  
  1332.                enum LSR_Masks
  1333.                              {
  1334.                               DR   =  0x0001,   // data ready
  1335.                               OE   =  0x0002,   // overrun error
  1336.                               PE   =  0x0004,   // parity error
  1337.                               FE   =  0x0008,   // framing error
  1338.                               BI   =  0x0010,   // break indication
  1339.                               THRE =  0x0020,   // THR empty
  1340.                               TSRE =  0x0040    // Transmit Shift empty
  1341.                               };
  1342.  
  1343.             Examples:
  1344.  
  1345.                SerialPort com1(COM_1,B_2400);
  1346.                ...
  1347.                if (com1.getLSR(BI)    // do this if line break detected
  1348.                     {
  1349.                     ...
  1350.  
  1351.  
  1352.             ++++++++++++++++++++++++++++++++++++++++
  1353.  
  1354.             getMSR
  1355.  
  1356.             Usage:
  1357.  
  1358.                int getMSR(MSR_Masks mm);
  1359.  
  1360.             Returns:
  1361.  
  1362.                An int value that is true (non-zero) if the 8250's Modem
  1363.                Status Register bit corresponding to the mask passed in is
  1364.                1, otherwise false (zero).
  1365.  
  1366.             Description:
  1367.  
  1368.                The 8250's Modem Status Register reflects the current state
  1369.                of several modem control lines.  By selecting the mask
  1370.                corresponding to the status line you wish to test from the
  1371.                enum MSR_Masks in SERIAL.H, you can use this routine to
  1372.                return the truth value of the modem line.  You may OR
  1373.                together several masks if you wish to test for multiple
  1374.                conditions in a single call.
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.                              19
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.             Parameters:
  1394.  
  1395.                MSR_Masks mm:       One or more mask values selected from
  1396.                                    the enum defined in SERIAL.H:
  1397.  
  1398.                enum MSR_Masks
  1399.                               {
  1400.                               DCTS =  0x0001, // delta clear to send
  1401.                               DDSR =  0x0002, // delta data set ready
  1402.                               TERI =  0x0004, // trailing edge ring ind
  1403.                               DDCD =  0x0008, // delta data carrier detect
  1404.                               CTS  =  0x0010, // clear to send
  1405.                               DSR  =  0x0020, // data set ready
  1406.                               RI   =  0x0040, // ring indicator
  1407.                               DCD  =  0x0080  // data carrier detect
  1408.                               };
  1409.  
  1410.             Examples:
  1411.  
  1412.                SerialPort com1(COM_1,B_2400);
  1413.                ...
  1414.                if (com1.getMSR(DCD)    // do this if carrier detected
  1415.                     {
  1416.                     ...
  1417.  
  1418.  
  1419.             ++++++++++++++++++++++++++++++++++++++++
  1420.  
  1421.             getParity
  1422.  
  1423.             Usage:
  1424.  
  1425.                Parity getParity(void);
  1426.  
  1427.             Returns:
  1428.  
  1429.                The enum Parity value in use by the port to which this
  1430.                instance is linked.
  1431.  
  1432.             Description:
  1433.  
  1434.                n/a
  1435.  
  1436.             Parameters:
  1437.  
  1438.                n/a
  1439.  
  1440.             Examples:
  1441.  
  1442.                SerialPort com1(COM_1);
  1443.                ...
  1444.                Parity ps = com1.getParity();
  1445.  
  1446.  
  1447.  
  1448.  
  1449.                              20
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.             ++++++++++++++++++++++++++++++++++++++++
  1460.  
  1461.             getSpeed
  1462.  
  1463.             Usage:
  1464.  
  1465.                Baud getSpeed(void);
  1466.  
  1467.             Returns:
  1468.  
  1469.                The enum Baud value in use by the port to which this
  1470.                instance is linked.
  1471.  
  1472.             Description:
  1473.  
  1474.                n/a
  1475.  
  1476.             Parameters:
  1477.  
  1478.                n/a
  1479.  
  1480.             Examples:
  1481.  
  1482.                SerialPort com1(COM_1);
  1483.                ...
  1484.                Baud sp = com1.getSpeed();
  1485.  
  1486.  
  1487.             ++++++++++++++++++++++++++++++++++++++++
  1488.  
  1489.             getStopBits
  1490.  
  1491.             Usage:
  1492.  
  1493.                StopBits getStopBits(void);
  1494.  
  1495.             Returns:
  1496.  
  1497.                The enum StopBits value in use by the port to which this
  1498.                instance is linked.
  1499.  
  1500.             Description:
  1501.  
  1502.                n/a
  1503.  
  1504.             Parameters:
  1505.  
  1506.                n/a
  1507.  
  1508.             Examples:
  1509.  
  1510.                SerialPort com1(COM_1);
  1511.                ...
  1512.                StopBits sb = com1.getStopBits();
  1513.  
  1514.  
  1515.                              21
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.             ++++++++++++++++++++++++++++++++++++++++
  1526.  
  1527.             inbyte
  1528.  
  1529.             Usage:
  1530.  
  1531.                int inbyte(unsigned char &cc,unsigned int timeout = 0);
  1532.  
  1533.             Returns:
  1534.  
  1535.                An int value, true (non-zero) if a character is read,
  1536.                otherwise false (zero).
  1537.  
  1538.             Description:
  1539.  
  1540.                This function reads one byte from the port's input buffer if
  1541.                it contains any.  If the buffer is empty, it will wait the
  1542.                number of milliseconds indicated by the timeout parameter;
  1543.                if a byte appears in the buffer within that time period, it
  1544.                reads it and returns.  If no byte appears in the buffer
  1545.                within the timeout period, the routine returns false, and
  1546.                the contents of the unsigned character reference is
  1547.                unchanged.
  1548.  
  1549.             Parameters:
  1550.  
  1551.                unsigned char cc:   A reference to the byte to receive the
  1552.                                    character read from the port.
  1553.  
  1554.                unsigned int timeout:   If positive, the number of
  1555.                                    milliseconds to wait for a character to
  1556.                                    appear if none are available
  1557.                                    immediately.  If zero, no waiting
  1558.                                    occurs; if a character is not
  1559.                                    immediately available, none is returned.
  1560.                                    The default for this parameter is zero.
  1561.  
  1562.             Examples:
  1563.  
  1564.                SerialPort com1(COM_1);
  1565.                unsigned char cbuf[20];
  1566.                ...
  1567.                if (com1.inbyte(cbuf[0],2000))  // char read within 2 secs.
  1568.                     {
  1569.                     ...                   // do this
  1570.  
  1571.  
  1572.             ++++++++++++++++++++++++++++++++++++++++
  1573.  
  1574.             inmem
  1575.  
  1576.             Usage:
  1577.  
  1578.                int inmem(void *mp, size_t msize, unsigned int timeout=0);
  1579.  
  1580.  
  1581.                              22
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.             Returns:
  1592.  
  1593.                An int value, true (non-zero) if all requested  characters
  1594.                are read, otherwise false (zero).
  1595.  
  1596.             Description:
  1597.  
  1598.                This function reads a specified number of bytes from the
  1599.                port's input buffer.  If the buffer is empty, it will wait
  1600.                the number of milliseconds indicated by the timeout
  1601.                parameter; if another byte appears in the buffer within that
  1602.                time period, it is read and the timer is reset.  If no byte
  1603.                appears in the buffer within the timeout period, the routine
  1604.                returns false, however many bytes have already been read.
  1605.  
  1606.                Remember that the timeout period you specify is per
  1607.                character read, and not a total cumulative value for the
  1608.                entire count of characters requested.
  1609.  
  1610.             Parameters:
  1611.  
  1612.                void *mp:           A void pointer to the starting byte to
  1613.                                    receive the characters read from the
  1614.                                    port.
  1615.  
  1616.                size_t msize:       The count of characters to read,
  1617.                                    expressed as an unsigned short. (size_t
  1618.                                    is defined in STDLIB.H).
  1619.  
  1620.                unsigned int timeout:   If positive, the number of
  1621.                                    milliseconds to wait for a character to
  1622.                                    appear if none are available
  1623.                                    immediately.  If zero, no waiting
  1624.                                    occurs; if a character is not
  1625.                                    immediately available, none is returned.
  1626.                                    The default for this parameter is zero.
  1627.  
  1628.             Examples:
  1629.  
  1630.                SerialPort com1(COM_1);
  1631.                unsigned char cbuf[20];
  1632.                ...
  1633.                if (com1.inmem(cbuf,sizeof(cbuf),2000))
  1634.                     {                   // all chars read within 2 secs.
  1635.                     ...              // do this
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.                              23
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.             ++++++++++++++++++++++++++++++++++++++++
  1658.  
  1659.             instr
  1660.  
  1661.             Usage:
  1662.  
  1663.                char *instr(char *buf,
  1664.                            size_t maxlen,
  1665.                            unsigned int timeout=0);
  1666.  
  1667.             Returns:
  1668.  
  1669.                The character pointer passed in as the first parameter.  No
  1670.                error conditions are returned if a timeout or buffer
  1671.                overflow occurs, but the contents of the buffer are
  1672.                guaranteed to be null terminated.  The buffer contents are
  1673.                unchanged if no characters are read.
  1674.  
  1675.             Description:
  1676.  
  1677.                This function reads bytes from the port's input buffer until
  1678.                and end-of-line is detected.  If the buffer is empty, it
  1679.                will wait the number of milliseconds indicated by the
  1680.                timeout parameter; if another byte appears in the buffer
  1681.                within that time period, it is read and the timer is reset.
  1682.                If no byte appears in the buffer within the timeout period,
  1683.                the routine returns false, however many bytes have already
  1684.                been read.
  1685.  
  1686.                Remember that the timeout period you specify is per
  1687.                character read, and not a total cumulative value for the
  1688.                entire count of characters requested.
  1689.  
  1690.                Function instr looks for a carriage return (0x0a) or a
  1691.                carriage return and line feed (0x0a0d) as an end-of-line
  1692.                indication.  These characters are not placed the output
  1693.                string.  It does not check the data placed in the string for
  1694.                nulls (0x00); if one appears in the port it will be placed
  1695.                in the output string and have the effect of terminating it
  1696.                prematurely.
  1697.  
  1698.                If the buffer size is exceeded by the characters coming from
  1699.                the port, maxlen-1 data characters, plus a terminating null
  1700.                are returned.
  1701.  
  1702.             Parameters:
  1703.  
  1704.                char *buf:          A pointer to the character buffer to
  1705.                                    receive the string read from the port.
  1706.  
  1707.                size_t msize:       The maximum number of characters the
  1708.                                    buffer will accommodate, including the
  1709.                                    terminating null, expressed as an
  1710.  
  1711.  
  1712.  
  1713.                              24
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.                                    unsigned short. (size_t is defined in
  1724.                                    STDLIB.H).
  1725.  
  1726.                unsigned int timeout:   If positive, the number of
  1727.                                    milliseconds to wait for a character to
  1728.                                    appear if none are available
  1729.                                    immediately.  If zero, no waiting
  1730.                                    occurs; if a character is not
  1731.                                    immediately available, none is returned.
  1732.                                    The default for this parameter is zero.
  1733.  
  1734.             Examples:
  1735.  
  1736.                SerialPort com1(COM_1);
  1737.                unsigned char cbuf[20];
  1738.                ...
  1739.                *cbuf='\0';
  1740.                com1.instr(cbuf,sizeof(cbuf),2000);
  1741.                if (*cbuf!='\0')
  1742.                     {             // any chars read within 2 secs.
  1743.                     ...         // do this
  1744.  
  1745.  
  1746.             ++++++++++++++++++++++++++++++++++++++++
  1747.  
  1748.             isOwner
  1749.  
  1750.             Usage:
  1751.  
  1752.                int isOwner(void);
  1753.  
  1754.             Returns:
  1755.  
  1756.                An integer value that is true (non-zero) if this instance is
  1757.                the owner of the associated port, false (zero) if this
  1758.                instance is only linked to the port.
  1759.  
  1760.             Description:
  1761.  
  1762.                n/a
  1763.  
  1764.             Parameters:
  1765.  
  1766.                n/a
  1767.  
  1768.             Examples:
  1769.  
  1770.                SerialPort com1(COM_1);
  1771.                ...
  1772.                if (com1.isOwner())       // if com1 is owner...
  1773.                     {                // do this
  1774.                     ...
  1775.  
  1776.  
  1777.  
  1778.  
  1779.                              25
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.             ++++++++++++++++++++++++++++++++++++++++
  1790.  
  1791.             lineOK
  1792.  
  1793.             Usage:
  1794.  
  1795.                int lineOK(void);
  1796.  
  1797.             Returns:
  1798.  
  1799.                An integer value that is true (non-zero) if the port is open
  1800.                and available, and false (zero) otherwise.  If keyboard
  1801.                breaks have not been disabled, lineOK() will report false if
  1802.                a keyboard break has been trapped.
  1803.  
  1804.             Description:
  1805.  
  1806.                n/a
  1807.  
  1808.             Parameters:
  1809.  
  1810.                n/a
  1811.  
  1812.             Examples:
  1813.  
  1814.                SerialPort com1(COM_1);
  1815.                ...
  1816.                if (com1.lineOK())   // if com1 is open and available...
  1817.                     {
  1818.                     ...          // do this
  1819.  
  1820.  
  1821.             ++++++++++++++++++++++++++++++++++++++++
  1822.  
  1823.             outbyte
  1824.  
  1825.             Usage:
  1826.  
  1827.                void outbyte(unsigned char cc);
  1828.  
  1829.             Returns:
  1830.  
  1831.                n/a
  1832.  
  1833.             Description:
  1834.  
  1835.                The unsigned character passed in to outbyte is written to
  1836.                the associated serial port.
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.                              26
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.             Parameters:
  1856.  
  1857.                unsigned character cc:  This character is written to the
  1858.                                    associated serial port.
  1859.  
  1860.             Examples:
  1861.  
  1862.                SerialPort com1(COM_1);
  1863.                ...
  1864.                com1.outbyte('A')   // write character 'A' to COM_1
  1865.                ...
  1866.  
  1867.  
  1868.             ++++++++++++++++++++++++++++++++++++++++
  1869.  
  1870.             outmem
  1871.  
  1872.             Usage:
  1873.  
  1874.                void outmem(const void *mp, size_t msize);
  1875.  
  1876.             Returns:
  1877.  
  1878.                n/a
  1879.  
  1880.             Description:
  1881.  
  1882.                Writes a specified number of bytes from a specific memory
  1883.                location to the associated port.
  1884.  
  1885.             Parameters:
  1886.  
  1887.                const void *mp:     Pointer to the first byte to write to
  1888.                                    the port.
  1889.  
  1890.                size_t msize:       Number of bytes to write, expressed as
  1891.                                    an unsigned short (size_t is defined in
  1892.                                    STDLIB.H).
  1893.  
  1894.             Examples:
  1895.  
  1896.                SerialPort com1(COM_1);
  1897.                char cbuf[20];
  1898.                ...
  1899.                com1.outmem(cbuf,sizeof(cbuf)) // write array to COM_1
  1900.                ...
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.                              27
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.             ++++++++++++++++++++++++++++++++++++++++
  1922.  
  1923.             outstr
  1924.  
  1925.             Usage:
  1926.  
  1927.                void outstr(const char *buf);
  1928.  
  1929.             Returns:
  1930.  
  1931.                n/a
  1932.  
  1933.             Description:
  1934.  
  1935.                Writes the null terminated string pointed to by the input
  1936.                parameter to the associated port.  outstr does not send the
  1937.                terminating null to the port, and does not send any extra
  1938.                characters (such as \n), after the string.  The count of
  1939.                characters sent is equal to strlen(buf).
  1940.  
  1941.             Parameters:
  1942.  
  1943.                const char *buf:    Pointer to the string to send to the
  1944.                                    associated port.
  1945.  
  1946.             Examples:
  1947.  
  1948.                SerialPort com1(COM_1);
  1949.                char cbuf[20]="ATZ";
  1950.                ...
  1951.                com1.outstr(cbuf)   // write string "ATZ" to COM_1
  1952.                com1.outbyte('\n'); // send new line after
  1953.                ...
  1954.  
  1955.  
  1956.             ++++++++++++++++++++++++++++++++++++++++
  1957.  
  1958.             sendBreak
  1959.  
  1960.             Usage:
  1961.  
  1962.                void sendBreak(int dur=750);
  1963.  
  1964.             Returns:
  1965.  
  1966.                n/a
  1967.  
  1968.             Description:
  1969.  
  1970.                This routine causes the associated serial port to send a
  1971.                line break for the number of milleseconds passed as the
  1972.                integer parameter.
  1973.  
  1974.  
  1975.  
  1976.  
  1977.                              28
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.             Parameters:
  1988.  
  1989.                int dur:            The duration of the line break, in
  1990.                                    milleseconds.  Defaults to 750
  1991.                                    milleseconds if omitted.
  1992.  
  1993.             Examples:
  1994.  
  1995.                SerialPort com1(COM_1);
  1996.                ...
  1997.                com1.sendBreak() // send 750 millisecond break on COM_1
  1998.                ...
  1999.  
  2000.  
  2001.             ++++++++++++++++++++++++++++++++++++++++
  2002.  
  2003.             setMCR
  2004.  
  2005.             Usage:
  2006.  
  2007.                int setMCR(MCR_Masks mm, int state);
  2008.  
  2009.             Returns:
  2010.  
  2011.                An integer value equal to that passed in as the int input
  2012.                parameter, state.
  2013.  
  2014.             Description:
  2015.  
  2016.                The 8250's Modem Control Register controls several features
  2017.                of the UART.  By selecting the mask corresponding to the
  2018.                UART feature you wish to enable or disable from the enum
  2019.                MCR_Masks in SERIAL.H, you can use this routine to change
  2020.                the operating condition of the UART.  You may OR together
  2021.                several masks if you wish to toggle multiple features in a
  2022.                single call.
  2023.  
  2024.             Parameters:
  2025.  
  2026.                MCR_Masks mm:       One or more mask values selected from
  2027.                                    the enum defined in SERIAL.H:
  2028.  
  2029.                   enum MCR_Masks
  2030.                                  {
  2031.                                  DTR    =  0x0001,   // data terminal ready
  2032.                                  RTS    =  0x0002,   // request to send
  2033.                                  OUT1   =  0x0004,   // aux user o/p 1
  2034.                                  OUT2   =  0x0008,   // aux user o/p 2
  2035.                                  LOOP   =  0x0010    // enable loopback
  2036.                                  };
  2037.  
  2038.                                    Be very careful about changing the state
  2039.                                    of OUT1, OUT2, and LOOP.  Do not toggle
  2040.                                    these lines unless you know exactly what
  2041.  
  2042.  
  2043.                              29
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.                                    you are doing -- you could disable the
  2054.                                    serial port altogether.
  2055.  
  2056.                int state:          This integer parameter turns on the
  2057.                                    features requested if it is true (non-
  2058.                                    zero), and turns off the feature is it
  2059.                                    is false (zero).
  2060.  
  2061.             Examples:
  2062.  
  2063.                SerialPort com1(COM_1,B_2400);
  2064.                int set_state = 1;
  2065.                com1.setMCR(DTR,set_state);    // set DTR on
  2066.                
  2067.  
  2068.  
  2069.             ++++++++++++++++++++++++++++++++++++++++
  2070.  
  2071.             unbyte
  2072.  
  2073.             Usage:
  2074.  
  2075.                void unbyte(unsigned char cc);
  2076.  
  2077.             Returns:
  2078.  
  2079.                n/a
  2080.  
  2081.             Description:
  2082.  
  2083.                The unsigned character passed in to unbyte is pushed back
  2084.                into the buffer of the associated serial port as the next
  2085.                character to be read.
  2086.  
  2087.                This routine is useful if you need to "look ahead" in the
  2088.                input stream for the second character of a two character
  2089.                escape sequence.
  2090.  
  2091.             Parameters:
  2092.  
  2093.                unsigned character cc:   This character is returned to the
  2094.                                    input buffer of the associated serial
  2095.                                    port.
  2096.  
  2097.             Examples:
  2098.  
  2099.                SerialPort com1(COM_1);
  2100.                unsigned char cc
  2101.                ...
  2102.                com1.inbyte(cc)        // read character from COM_1
  2103.                if (cc=='\t')
  2104.                     ...              // do this if a tab
  2105.                else
  2106.                     com1.unbyte(cc); // otherwise put it back for next read
  2107.  
  2108.  
  2109.                              30
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.           BreakTrap Function Reference
  2120.  
  2121.  
  2122.             ++++++++++++++++++++++++++++++++++++++++
  2123.  
  2124.             constructor
  2125.  
  2126.             Usage:
  2127.  
  2128.                BreakTrap(void);
  2129.  
  2130.             Returns:
  2131.  
  2132.                n/a
  2133.  
  2134.             Description:
  2135.  
  2136.                The BreakTrap constructor allocates an instance of
  2137.                BreakTrap, and links it to the break trap anchor that
  2138.                services keyboard break interrupts.  If the trap is not
  2139.                currently set, BreakTrap sets it and makes this instance the
  2140.                trap owner.  If the break trap is already set, this instance
  2141.                is linked to it, and full access to all trap flags and
  2142.                controls.
  2143.  
  2144.                In either case, after creating an instance of BreakTrap, the
  2145.                break trap anchor routines capture each Control-Break and
  2146.                Control-C pressed, and record theses events by incrementing
  2147.                a counter.  No other response to the break is made, and any
  2148.                routine that contains an instance of BreakTrap within its
  2149.                scope can check the counter at any time to determine if a
  2150.                break has occurred.
  2151.  
  2152.             Parameters:
  2153.  
  2154.                n/a
  2155.  
  2156.             Examples:
  2157.  
  2158.                BreakTrap bt;
  2159.                ...
  2160.                BreakTrap *btp = new BreakTrap;
  2161.                ...
  2162.  
  2163.  
  2164.             ++++++++++++++++++++++++++++++++++++++++
  2165.  
  2166.             destructor
  2167.  
  2168.             Usage:
  2169.  
  2170.                n/a
  2171.  
  2172.  
  2173.  
  2174.  
  2175.                              31
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.             Returns:
  2186.  
  2187.                n/a
  2188.  
  2189.             Description:
  2190.  
  2191.                The BreakTrap destructor deallocates the storage associated
  2192.                with this instance.  If this instance is the owner of the
  2193.                trap, the trap is released and all trapped interrupts are
  2194.                returned to their prior state.  If the current instance is
  2195.                not the trap owner, the trap is not released.  If you wish
  2196.                to release the trap, you must destroy the BreakTrap instance
  2197.                that owns the trap.
  2198.  
  2199.                A trap may be released or released and set again even if
  2200.                other non-owner instances remain linked to the trap.
  2201.                Attempts to use the trap while it is released returns
  2202.                indications that no breaks have occurred, and causes no
  2203.                harm.
  2204.  
  2205.             Parameters:
  2206.  
  2207.                n/a
  2208.  
  2209.             Examples:
  2210.  
  2211.                BreakTrap bt1= new BreakTrap;  // bt1 owns trap
  2212.                if (...
  2213.                     {
  2214.                     BreakTrap bt2;   // bt2 is just linked
  2215.                     ...
  2216.                     }                // bt2 destroyed, trap still set
  2217.                     ...
  2218.                     delete bt1       // now the trap is released;
  2219.  
  2220.  
  2221.             ++++++++++++++++++++++++++++++++++++++++
  2222.  
  2223.             breakCt
  2224.  
  2225.             Usage:
  2226.  
  2227.                unsigned int breakCt(void);
  2228.  
  2229.             Returns:
  2230.  
  2231.                An unsigned int value that is the count of the number of
  2232.                keyboard breaks that have occurred since the counter was
  2233.                last reset.
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.                              32
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.             Description:
  2252.  
  2253.                Each time a Control-Break or Control-C is pressed while
  2254.                break trapping is enabled, a counter is incremented by
  2255.                BreakTrap.  This routine returns the current count of break
  2256.                events.
  2257.  
  2258.                This counter can be reset by reset() member function
  2259.                described below.
  2260.  
  2261.             Parameters:
  2262.  
  2263.                n/a
  2264.  
  2265.             Examples:
  2266.  
  2267.                BreakTrap bt;
  2268.                ...
  2269.                if (bt.breakCt()>1)   // if more than one break occurred
  2270.                     {
  2271.                     ...             // do this
  2272.  
  2273.  
  2274.             ++++++++++++++++++++++++++++++++++++++++
  2275.  
  2276.             isBreak
  2277.  
  2278.             Usage:
  2279.  
  2280.                int isBreak(void);
  2281.  
  2282.             Returns:
  2283.  
  2284.                An integer value that is true (non-zero) if at least one
  2285.                keyboard break has been counted since the last reset,
  2286.                otherwise false (zero).
  2287.  
  2288.             Description:
  2289.  
  2290.                Each time a Control-Break or Control-C is pressed while
  2291.                break trapping is enabled, a counter is incremented by
  2292.                BreakTrap.  This routine returns true (non-zero) if the
  2293.                current count of break events is non-zero.
  2294.  
  2295.             Parameters:
  2296.  
  2297.                n/a
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.                              33
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.             Examples:
  2318.  
  2319.                BreakTrap bt;
  2320.                ...
  2321.                if (bt.isBreak())     // if any breaks have occurred
  2322.                     {
  2323.                     ...             // do this
  2324.  
  2325.  
  2326.             ++++++++++++++++++++++++++++++++++++++++
  2327.  
  2328.             isCaptured
  2329.  
  2330.             Usage:
  2331.  
  2332.                int isCaptured(void);
  2333.  
  2334.             Returns:
  2335.  
  2336.                An integer value that is true (non-zero) if the break trap
  2337.                anchor is currently active and trapping breaks, otherwise
  2338.                false (zero).
  2339.  
  2340.             Description:
  2341.  
  2342.                When more that one instance of BreakTrap exist in a program,
  2343.                only one is the owner of the break trap.  If the owner
  2344.                instance is destroyed, the trap is released -- however the
  2345.                non-owner instances continue to exist.  This function allows
  2346.                any instance, owner or otherwise, to verify that the trap is
  2347.                currently set and keyboard breaks are being trapped.
  2348.  
  2349.                If the owner instance has been destroyed, and the trap is
  2350.                released, any other instance checking for breaks will see no
  2351.                breaks counted, i.e. will be unaware that the trap has been
  2352.                released.  It is therefore good practice to use isCaptured()
  2353.                whenever multiple instances of BreakTrap are used.
  2354.  
  2355.             Parameters:
  2356.  
  2357.                n/a
  2358.  
  2359.             Examples:
  2360.  
  2361.                BreakTrap bt;
  2362.                ...
  2363.                if (bt.isCaptured()&&bt.isBreak()) // if trap is set and
  2364.                     {                            // any breaks have
  2365.                occurred
  2366.                     ...                          // do this
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.                              34
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.             ++++++++++++++++++++++++++++++++++++++++
  2384.  
  2385.             isOwner
  2386.  
  2387.             Usage:
  2388.  
  2389.                int isOwner(void);
  2390.  
  2391.             Returns:
  2392.  
  2393.                An integer value that is true (non-zero) if this instance is
  2394.                the owner of the break trap, otherwise false (zero).
  2395.  
  2396.             Description:
  2397.  
  2398.                This routine enables any instance to determine if it is the
  2399.                owner of the break trap.  Since the destruction of the trap
  2400.                owner shuts off break trapping, and leaves the application
  2401.                program susceptible to user interruption, it is dangerous to
  2402.                destroy the trap owner.
  2403.  
  2404.                By checking to determine if a particular instance is trap
  2405.                owner before deleting it, you can avoid losing break
  2406.                protection.
  2407.  
  2408.             Parameters:
  2409.  
  2410.                n/a
  2411.  
  2412.             Examples:
  2413.  
  2414.                ...
  2415.                BreakTrap *bt = new BreakTrap;
  2416.                ...
  2417.                if (!bt->isOwner()) // if instance is not owner
  2418.                     delete bt:    // okay to delete it
  2419.                     ...
  2420.  
  2421.  
  2422.             ++++++++++++++++++++++++++++++++++++++++
  2423.  
  2424.             operator()
  2425.  
  2426.             Usage:
  2427.  
  2428.                int operator()(void);
  2429.  
  2430.             Returns:
  2431.  
  2432.                An integer value that is true (non-zero) if breaks are
  2433.                currently being trapped and at least one break has been
  2434.                counted since the last reset, otherwise false (zero).
  2435.  
  2436.  
  2437.  
  2438.  
  2439.                              35
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.             Description:
  2450.  
  2451.                This overloaded function operator provides a convenient
  2452.                shorthand way to query the break trap about its state.  The
  2453.                trap is tested to determine whether it is active and whether
  2454.                any breaks have been occurred.  After testing the trap, this
  2455.                function also resets it, i.e. sets the count of breaks
  2456.                trapped since the last reset to zero.
  2457.  
  2458.                Invoking this overloaded operator is the equivalent of
  2459.                making three consecutive member functions: isCaptured(),
  2460.                isBreak() and reset().  See the example below.
  2461.  
  2462.             Parameters:
  2463.  
  2464.                n/a
  2465.  
  2466.             Examples:
  2467.  
  2468.                BreakTrap bt;
  2469.                ...
  2470.                if (bt())  // test for trap open and breaks occurred
  2471.                     {    // break counter reset after test
  2472.                     ...  // breaks are detected, do this
  2473.  
  2474.             The above example is equivalent to the following code:
  2475.  
  2476.                BreakTrap bt;
  2477.                ...
  2478.                if (bt.isCaptured())    // test if trap operating
  2479.                     if (bt.isBreak()) // any breaks caught?
  2480.                          {
  2481.                          bt.reset(); // reset break counter
  2482.                          ...         // do this
  2483.  
  2484.             Note also that this overloaded operator notation requires a
  2485.             reference to the instance, not a pointer to it.  If you have a
  2486.             pointer to the instance, you must dereference in explicitly:
  2487.  
  2488.                BreakTrap *btp = new BreakTrap;
  2489.                ...
  2490.                if ((*btp)())     // test and reset
  2491.                     {
  2492.                     ...       // do this if breaks have occurred.
  2493.  
  2494.  
  2495.             ++++++++++++++++++++++++++++++++++++++++
  2496.  
  2497.             reset
  2498.  
  2499.             Usage:
  2500.  
  2501.                void reset(void);
  2502.  
  2503.  
  2504.  
  2505.                              36
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.             Returns:
  2516.  
  2517.                n/a
  2518.  
  2519.             Description:
  2520.  
  2521.                Each time a Control-Break or Control-C is pressed while
  2522.                break trapping is enabled, a counter is incremented by
  2523.                BreakTrap.  This routine resets that counter to zero.
  2524.  
  2525.             Parameters:
  2526.  
  2527.                n/a
  2528.  
  2529.             Examples:
  2530.  
  2531.                BreakTrap bt;
  2532.                ...
  2533.                if (bt.isBreak())  // any breaks caught?
  2534.                     {
  2535.                     bt.reset();  // reset break counter
  2536.                     ...          // do this
  2537.  
  2538.  
  2539.           Serial++ License and Registration
  2540.  
  2541.             Serial++ is Shareware
  2542.  
  2543.             Serial++ is a copyrighted computer program which is being
  2544.             distributed as shareware.  It is not a public domain program,
  2545.             and it is not free.
  2546.  
  2547.             Shareware is a distribution technique allows you the user a
  2548.             legal but limited trial period to evaluate a program before
  2549.             purchase.  If you continue to use the program after the trial
  2550.             period has ended, you must pay for the program by registering
  2551.             it.  You are also allowed to distribute evaluation copies of
  2552.             this software to others subject to certain limitations detailed
  2553.             below.
  2554.  
  2555.             This system of "try before you buy" allows you the user to get
  2556.             the most out of your software dollar by evaluating a
  2557.             prospective software purchase under its actual conditions of
  2558.             use.  For small software vendors such as Cortlandt
  2559.             Technologies, it represents a viable way of reaching a
  2560.             potential market, without the large costs and risks of self-
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.                              37
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.             publishing.  Many fine programs in commercial release today
  2582.             would not be available if the shareware concept did not exist.
  2583.  
  2584.             Please support the shareware concept by registering those
  2585.             programs you actually use and by passing them on to others.
  2586.  
  2587.             Registration Information
  2588.  
  2589.             Serial++ is provided at no charge for evaluation purposes only.
  2590.             This shareware version of Serial++ is the complete working
  2591.             version of the library, not a crippled or demo copy.
  2592.  
  2593.             Cortlandt Technologies, hereby grants you a limited license to
  2594.             use this software for evaluation purposes only for a period not
  2595.             to exceed 30 days.  If you intend to continue using this
  2596.             software after the 30-day evaluation period, you must register
  2597.             it by paying the registration fee to Cortlandt Technologies.
  2598.  
  2599.             Serial++ is a library of routines which may be included in
  2600.             software you develop and distribute with no additional
  2601.             royalties ONLY IF YOU HAVE PAID THE ONE TIME REGISTRATION FEE
  2602.             TO CORTLANDT TECHNOLOGIES.  If you have registered your copy of
  2603.             Serial++, you have the right to unrestricted distribution of
  2604.             any software you develop using it.
  2605.  
  2606.             Using this software after the evaluation period has ended, or
  2607.             distributing your own software developed with it, without
  2608.             registering it is a violation of the terms of this limited
  2609.             license.
  2610.  
  2611.             The $24.95 registration fee licenses one copy of the software
  2612.             for use on one computer at any given time.  You may have copies
  2613.             of Serial++ on more than one computer, as long as it is not
  2614.             possible for more than one copy to be in use at one time.  Site
  2615.             licenses, or multiple computers on a local area network, are
  2616.             quoted on a per case basis, please contact Cortlandt
  2617.             Technologies for current multiple user license information.
  2618.  
  2619.             Upon registering your copy of Serial++, you will receive:
  2620.  
  2621.             >  A printed manual
  2622.  
  2623.             >  Complete BORLAND C++ source code for the Serial++ class
  2624.                  library.
  2625.  
  2626.             >  The most current version of the Serial++ library.  This
  2627.                  includes all maintenance changes and revisions made at the
  2628.                  time you place your order.
  2629.  
  2630.             >  Free technical support, via mail or Compuserve for one year
  2631.                  after registration date.
  2632.  
  2633.             >  Notification of future releases of Serial++.
  2634.  
  2635.  
  2636.  
  2637.                              38
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.             Limited Distribution License
  2648.  
  2649.             Cortlandt Technologies encourages you to freely copy and
  2650.             distribute the unregistered version of Serial++ subject to the
  2651.             following restrictions:
  2652.  
  2653.             >  You may only distribute the complete Serial++ package, in
  2654.                  its original self-extracting archive file. You may not
  2655.                  distribute the unarchived form of any Serial++ files.
  2656.  
  2657.             >  None of the files comprising Serial++, program or
  2658.                  documentation, may be modified in any way and must be
  2659.                  distributed as a complete package, intact.
  2660.  
  2661.             >  You may charge a distribution fee for the package, but you
  2662.                  must not represent in any way that you are selling the
  2663.                  software itself.
  2664.  
  2665.             >  Documentation in printed form may not be reproduced in whole
  2666.                  or in part, using any means, without the prior written
  2667.                  permission of Cortlandt Technologies.  This restriction
  2668.                  includes both bound documentation, and printouts you make
  2669.                  of the documentation included in the distribution file on
  2670.                  diskette.
  2671.  
  2672.             >  You may not use, copy, rent, lease, sell or transfer the
  2673.                  licensed program except as provided in this agreement.
  2674.                  Any such unauthorized use shall result in immediate and
  2675.                  automatic termination of this license.
  2676.  
  2677.             >  Cortlandt Technologies reserves the right to withdraw
  2678.                  permission from any vendor to distribute our products at
  2679.                  any time and for any reason.
  2680.  
  2681.             All rights not expressly granted here are reserved by Cortlandt
  2682.             Technologies,
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.                              39
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.                                   Serial++ Order Form
  2714.  
  2715.           To register your copy of Serial++ please send $24.95 and this
  2716.           form to:
  2717.  
  2718.           Cortlandt Technologies
  2719.           P.O. Box 195
  2720.           Pleasantville, NY 10570
  2721.  
  2722.           You will receive the latest version of Serial++ complete with
  2723.           source code, a printed version of the manual, be eligible for
  2724.           technical support via mail and Compuserv, and be placed in our
  2725.           user database to automatically receive notices of upgrades and
  2726.           releases.  See the section in this manual on licensing and
  2727.           registration for more details.
  2728.  
  2729.           Please fill in the information requested below:
  2730.  
  2731.           . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  2732.  
  2733.              Name _________________________________________________________
  2734.  
  2735.             Title _________________________________________________________
  2736.  
  2737.           Company _________________________________________________________
  2738.  
  2739.           Address _________________________________________________________
  2740.  
  2741.                   _________________________________________________________
  2742.  
  2743.              City _________________________________________________________
  2744.  
  2745.             State _______ Postal _______  Country _________________________
  2746.            (Prov)         Code
  2747.  
  2748.            Daytime Phone ______________________ Evenings __________________
  2749.  
  2750.           __ I have enclosed $24.95 in __ Check __ Money Order.
  2751.  
  2752.           __ I am interested in multiple user or site license.
  2753.  
  2754.           Also, please tell us how you heard about Serial++, and where you
  2755.           got your evaluation copy?
  2756.  
  2757.           _________________________________________________________________
  2758.  
  2759.           Thank you for registering your copy of Serial++!
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.                              40
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.  
  2778.  
  2779.                                         Index
  2780.  
  2781.           8250 UART  5
  2782.           Archive file  6
  2783.           Aux user o/p 1  29
  2784.           Aux user o/p 2  29
  2785.           Baud  21
  2786.           BI  19
  2787.           Break trapping  12
  2788.           BreakCt  33
  2789.           BreakTrap  13
  2790.           Clear to send  20
  2791.           CommPorts  14, 17
  2792.           Constructor, BreakTrap  31
  2793.           Constructor, SerialPort  14, 15
  2794.           CTS  20
  2795.           Data bits  15
  2796.           Data carrier detect  20
  2797.           Data ready  19
  2798.           Data set ready  20
  2799.           Data terminal ready  29
  2800.           DataBits  18
  2801.           DCD  20
  2802.           DCTS  20
  2803.           DDCD  20
  2804.           DDSR  20
  2805.           Delta clear to send  20
  2806.           Delta data carrier detect  20
  2807.           Delta data set ready  20
  2808.           Destructor, BreakTrap  32
  2809.           Destructor, SerialPort  15, 16
  2810.           Distribution of Serial++  39
  2811.           DR  19
  2812.           DSR  20
  2813.           DTR  29
  2814.           Enum parameters  12
  2815.           FE  19
  2816.           Framing error  19
  2817.           GetBreakOff  17
  2818.           GetCommPort  18
  2819.           GetDataBits  18
  2820.           GetLSR  19
  2821.           GetMSR  20
  2822.           GetParity  21
  2823.           GetSpeed  21
  2824.           GetStopBits  21
  2825.           Inbyte  22
  2826.           Include files  6, 7
  2827.           Inmem  24
  2828.           Input buffer  15
  2829.           Installation  6
  2830.           Instantiation  11
  2831.           Instr  25
  2832.           Interrupt service routine  11
  2833.  
  2834.  
  2835.                               
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.           Interrupt service routines, in overlays  14
  2846.           Interrupts  5, 16
  2847.           IsBreak  34
  2848.           IsCaptured  35
  2849.           IsOwner, BreakTrap  35
  2850.           IsOwner, SerialPort  26
  2851.           Keyboard breaks  15, 17, 26
  2852.           Library files  6, 7, 13
  2853.           Line break  28
  2854.           Line break indication  19
  2855.           Line Status Register  18
  2856.           LineOK  26
  2857.           LOOP  29
  2858.           Loopback enable  29
  2859.           LSR  18
  2860.           LSR_Masks  18
  2861.           MCR  29
  2862.           MCR_Masks  29
  2863.           Memory models  13
  2864.           Modem Control Register  29
  2865.           Modem Status Register  19
  2866.           MS-DOS  5
  2867.           MSR  19
  2868.           MSR_Masks  19
  2869.           Non-owner instances  16
  2870.           OE  19
  2871.           Order form, Serial++  40
  2872.           OUT1  29
  2873.           OUT2  29
  2874.           Outbyte  27
  2875.           Outmem  28
  2876.           Outstr  28
  2877.           Overlays  14
  2878.           Overloaded operator(), BreakTrap  36
  2879.           Overrun error  19
  2880.           Owner  11, 25, 34
  2881.           PACKING.LST  6
  2882.           Parity  15, 20
  2883.           Parity error  19
  2884.           PE  19
  2885.           Port addresses  5
  2886.           Port anchor  10
  2887.           Port parameters  11, 16
  2888.           Port speed  15
  2889.           PortAnchor  11
  2890.           READ.ME  6
  2891.           Registration of Serial++  39
  2892.           Request to send  29
  2893.           Reset, BreakTrap  37
  2894.           RI  20
  2895.           Ring indicator  20
  2896.           RTS  29
  2897.           SendBreak  29
  2898.           SerialPort  12
  2899.  
  2900.  
  2901.                               
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.           SetMCR  30
  2912.           Shareware  38
  2913.           Smart modem  10
  2914.           SPP.EXE  6
  2915.           SPPDEMO.EXE  9
  2916.           SPPMAN.TXT  6
  2917.           SPPx.LIB  6
  2918.           Static  13
  2919.           Stop bits  15
  2920.           StopBits  21
  2921.           TERI  20
  2922.           THR empty  19
  2923.           THRE  19
  2924.           Timeout  22, 23, 24, 25
  2925.           Trailing edge ring indicator  20
  2926.           Transmit Shift empty  19
  2927.           TSR's  4, 5
  2928.           TSRE  19
  2929.           Unbyte  30
  2930.           Virtual functions  12
  2931.  
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942.  
  2943.  
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.                               
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.  
  2975.  
  2976.  
  2977.  
  2978.             
  2979.  
  2980.  
  2981.  
  2982.  
  2983.  
  2984.  
  2985.  
  2986.  
  2987.  
  2988.  
  2989.  
  2990.  
  2991.  
  2992.  
  2993.  
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.